from com.Database import Base
from sqlalchemy import Column, Integer, Float, Sequence, String

class BookEntity(Base):
    __tablename__ = 'books'

    id = Column(Integer, Sequence('id_seq'), primary_key=True)
    name = Column(String(50))
    author = Column(String(50))
    price = Column(String(50))

    def __init__(self, name, author, price):
        self.name = name
        self.author = author
        self.price = price

    def obj_2_json(obj):
        return {"name": obj.name, "author": obj.author, "price": obj.price}